package com.zlzxm.shoesmarket.view.fragment;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.zlzxm.shoesmarket.util.toasty.ToastyEvent;
import com.zlzxm.shoesmarket.util.toasty.ToastyUtil;

/**
 * CREATE BY zlzxm ON 4/7/21
 */
public class BaseFragment  extends Fragment implements ToastyEvent {


    protected String title = "title";

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        initView(view,savedInstanceState);

        initViewModel();

        initData();
    }

    protected void initView(@NonNull View view,@NonNull Bundle savedInstanceState){}

    protected void initViewModel(){};

    protected void initData(){}

    @Override
    public void infoToast(String msg) {

        ToastyUtil.infoToast(getContext(),msg);
    }

    @Override
    public void errorToast(String msg) {

        ToastyUtil.errorToast(getContext(),msg);
    }

    @Override
    public void succeedToast(String msg) {

        ToastyUtil.succeedToast(getContext(),msg);
    }

    @Override
    public void warningToast(String msg) {
        ToastyUtil.warningToast(getContext(),msg);
    }

    @Override
    public void normalToast(String msg) {
        ToastyUtil.normalToast(getContext(),msg);
    }
}
